home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13512 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: mayne.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng
  4. Subject: Re: Beware of "C" Hackers -- A rebuttal to Bertrand Meyer
  5. Date: 25 Mar 1996 18:29:25 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4j7kq5INN26p@mayne.ugrad.cs.ubc.ca>
  8. References: <1995Jul3.034108.4193@rcmcon.com> <3154A548.71FF@iadfw.net> <4j3p80INN567@keats.ugrad.cs.ubc.ca> <827765484snz@tsys.demon.co.uk>
  9. NNTP-Posting-Host: mayne.ugrad.cs.ubc.ca
  10.  
  11. In article <827765484snz@tsys.demon.co.uk>,
  12. Tom Wheeley  <tomw@tsys.demon.co.uk> wrote:
  13.  
  14.  >Surely you have just proved that the standard library is _not_ part of the
  15.  >C language.  At the risk of seeming -pedantic, I would say that the standard
  16.  >library is a part of the _standard C *implementation*_, but not a part of
  17.  >the standard C *language*.
  18.  >
  19.  >That is why you can build the standard library within C -- you cannot write
  20.  >the entire standard library using the standard library, therefore if the
  21.  >standard library is a part of the C language, then the standard library is
  22.  >no longer written in the C language, but only a limited subset thereof.
  23.  
  24. No, you would use somewhat of a superset: you would require special glue to
  25. interface to the environment, otherwise you could not do I/O or dynamic memory
  26. allocation. These methods are not defined by the C language. Of course, you
  27. could use some standard library functions to build others, or even to define
  28. themselves. 
  29.  
  30. What you are missing is that in _building_ the standard C implementation, one
  31. does not follow the same rules that go into _using_ ANSI C. Some of the steps
  32. in constructing the environment are not steps that are legal for the user of a
  33. hosted C implementation.
  34.  
  35. In constructing the environment, I could have a special rule that would allow
  36. me to do this:
  37.  
  38. int strcmp(const char *s1, const char *s2)
  39.  
  40. {
  41.     return strcmp(s1, s2);
  42. }
  43.  
  44. Where the internal strcmp() is assumed to be the special operator (whose
  45. unconditional translation I could theoretically turn on with a special flag in
  46. my compiler---not that this is how it's actually done!).
  47.  
  48. Of course, the above is not possible from the point of view of the user,
  49. because it is tantamount to an external redefinition of a standard defined
  50. function.
  51.  
  52. The user of the library would have the inlined operator strcmp(), and could
  53. take the address of the above function version when needed (e.g. for passing
  54. a pointer to the comparison function to a sorting routine).
  55. -- 
  56.  
  57.